<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>menuseparatorrenderer.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
  </script>

  <script src="static/js/doc.js">
  </script>

  <meta charset="utf8">
</head>

<body onload="prettyPrint()">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="closure_goog_ui_menuseparatorrenderer.js.html">menuseparatorrenderer.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line2"></a>// you may not use this file except in compliance with the License.
<a name="line3"></a>// You may obtain a copy of the License at
<a name="line4"></a>//
<a name="line5"></a>//     http://www.apache.org/licenses/LICENSE-2.0
<a name="line6"></a>//
<a name="line7"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line8"></a>// distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
<a name="line9"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line10"></a>// See the License for the specific language governing permissions and
<a name="line11"></a>// limitations under the License.
<a name="line12"></a>
<a name="line13"></a>// Copyright 2008 Google Inc. All Rights Reserved.
<a name="line14"></a>
<a name="line15"></a>/**
<a name="line16"></a> * @fileoverview Renderer for {@link goog.ui.MenuSeparator}s.
<a name="line17"></a> *
<a name="line18"></a> */
<a name="line19"></a>
<a name="line20"></a>goog.provide(&#39;goog.ui.MenuSeparatorRenderer&#39;);
<a name="line21"></a>
<a name="line22"></a>goog.require(&#39;goog.dom&#39;);
<a name="line23"></a>goog.require(&#39;goog.dom.classes&#39;);
<a name="line24"></a>goog.require(&#39;goog.ui.ControlContent&#39;);
<a name="line25"></a>goog.require(&#39;goog.ui.ControlRenderer&#39;);
<a name="line26"></a>
<a name="line27"></a>
<a name="line28"></a>/**
<a name="line29"></a> * Renderer for menu separators.
<a name="line30"></a> * @constructor
<a name="line31"></a> * @extends {goog.ui.ControlRenderer}
<a name="line32"></a> */
<a name="line33"></a>goog.ui.MenuSeparatorRenderer = function() {
<a name="line34"></a>  goog.ui.ControlRenderer.call(this);
<a name="line35"></a>};
<a name="line36"></a>goog.inherits(goog.ui.MenuSeparatorRenderer, goog.ui.ControlRenderer);
<a name="line37"></a>goog.addSingletonGetter(goog.ui.MenuSeparatorRenderer);
<a name="line38"></a>
<a name="line39"></a>
<a name="line40"></a>/**
<a name="line41"></a> * Default CSS class to be applied to the root element of components rendered
<a name="line42"></a> * by this renderer.
<a name="line43"></a> * @type {string}
<a name="line44"></a> */
<a name="line45"></a>goog.ui.MenuSeparatorRenderer.CSS_CLASS = goog.getCssName(&#39;goog-menuseparator&#39;);
<a name="line46"></a>
<a name="line47"></a>
<a name="line48"></a>/**
<a name="line49"></a> * Returns an empty, styled menu separator DIV.  Overrides {@link
<a name="line50"></a> * goog.ui.ControlRenderer#createDom}.
<a name="line51"></a> * @param {goog.ui.Separator} separator Separator to render.
<a name="line52"></a> * @return {Element} Root element for the separator.
<a name="line53"></a> */
<a name="line54"></a>goog.ui.MenuSeparatorRenderer.prototype.createDom = function(separator) {
<a name="line55"></a>  return separator.getDomHelper().createDom(&#39;div&#39;, this.getCssClass());
<a name="line56"></a>};
<a name="line57"></a>
<a name="line58"></a>
<a name="line59"></a>/**
<a name="line60"></a> * Takes an existing element, and decorates it with the separator.  Overrides
<a name="line61"></a> * {@link goog.ui.ControlRenderer#decorate}.
<a name="line62"></a> * @param {goog.ui.Separator} separator Separator to decorate the element.
<a name="line63"></a> * @param {Element} element Element to decorate.
<a name="line64"></a> * @return {Element} Decorated element.
<a name="line65"></a> */
<a name="line66"></a>goog.ui.MenuSeparatorRenderer.prototype.decorate = function(separator,
<a name="line67"></a>                                                            element) {
<a name="line68"></a>  if (element.tagName == &#39;HR&#39;) {
<a name="line69"></a>    // Replace HR with separator.
<a name="line70"></a>    var hr = element;
<a name="line71"></a>    element = this.createDom(separator);
<a name="line72"></a>    goog.dom.insertSiblingBefore(element, hr);
<a name="line73"></a>    goog.dom.removeNode(hr);
<a name="line74"></a>  } else {
<a name="line75"></a>    goog.dom.classes.add(element, this.getCssClass());
<a name="line76"></a>  }
<a name="line77"></a>  return element;
<a name="line78"></a>};
<a name="line79"></a>
<a name="line80"></a>
<a name="line81"></a>/**
<a name="line82"></a> * Overrides {@link goog.ui.ControlRenderer#setContent} to do nothing, since
<a name="line83"></a> * separators are empty.
<a name="line84"></a> * @param {Element} separator The separator&#39;s root element.
<a name="line85"></a> * @param {goog.ui.ControlContent} content Text caption or DOM structure to be
<a name="line86"></a> *    set as the separators&#39;s content (ignored).
<a name="line87"></a> */
<a name="line88"></a>goog.ui.MenuSeparatorRenderer.prototype.setContent = function(separator,
<a name="line89"></a>                                                              content) {
<a name="line90"></a>  // Do nothing.  Separators are empty.
<a name="line91"></a>};
<a name="line92"></a>
<a name="line93"></a>
<a name="line94"></a>/**
<a name="line95"></a> * Returns the CSS class to be applied to the root element of components
<a name="line96"></a> * rendered using this renderer.
<a name="line97"></a> * @return {string} Renderer-specific CSS class.
<a name="line98"></a> */
<a name="line99"></a>goog.ui.MenuSeparatorRenderer.prototype.getCssClass = function() {
<a name="line100"></a>  return goog.ui.MenuSeparatorRenderer.CSS_CLASS;
<a name="line101"></a>};
</pre>


</body>
</html>
